package com.yywz.collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.SortedSet;
import java.util.TreeSet;

public class TestCollection {

	public static void main(String[] args) {
		
		TestCollection test = new TestCollection();
//		test.testLinkedList();
		
		try {
			test.testTreeSet();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		
	}
	
	public void testLinkedList() {
		List<String> linkedList = new LinkedList<String>();
		linkedList.add("a");
		linkedList.add("b");
		System.out.println(linkedList.get(1));
	} 
	
	public void testLinkedList2() {
		List<String> arrayList = new ArrayList<String>();
		arrayList.add("a");
		arrayList.add("b");
		
		List<String> linkedList = new LinkedList<String>(arrayList);
		
		System.out.println(linkedList);
		
		
	}
	
	public void testTreeSet() {
		SortedSet<String> sort = new TreeSet<String>();
		sort.add("Nick");
		sort.add("Alice");
		sort.add("Tom");
		
		for(String s : sort) {
			System.out.println(s);
		}
		
	}
	
}
